<!DOCTYPE HTML>

<html>
  <head>
      <script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"></script>
	  <script type="text/javascript" charset="utf-8" src="functions.js"></script>
	  <script type="text/javascript" charset="utf-8" src="zepto.min.js"></script>
	  <script type="text/javascript" charset="utf-8">

		// Call onDeviceReady when PhoneGap is loaded.
		//
		// At this point, the document has loaded but phonegap has not.
		// When PhoneGap is loaded and talking with the native device,
		// it will call the event `deviceready`.
		// 
		document.addEventListener("deviceready", onDeviceReady, false);

		// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
		//
		function onDeviceReady() {
			// Now safe to use the PhoneGap API
		}
		
		//function to validate positive floating numbers greater than 0
		function validatePositiveNum(num)
		{
			return num!="" && !isNaN(num) && num >= 0;
		}
		
		//function to validate form before submission
		function validateForm() {
			if (!validatePositiveNum(document.forms["frmNew"]["points"].value)) {
				alert("Points must be number greater than or equal to 0");
				return false;
			}
			if (isNaN(parseInt(document.forms["frmNew"]["session"].value))) {
				alert("Session must be number greater than or equal to 0");
				return false;
			}			
			return true;
		}

      </script>

	  <link href="styles.css" rel="stylesheet" type="text/css">
  </head>
  <body onload="resizeElementHeight('contentholder')">
	<div id="container">
		<div id="header">
			<h1>TrainingTracker</h1>
		</div>
		<div id="contentholder">
			<h1>New Session Entry</h1>
			<form name="frmNew" onsubmit="return validateForm()">
			<fieldset>
				<legend>New Session Entry</legend>
				<label for="datefield">Date:</label><br />
				<input type="text" name="datefield" /><br />
				<label for="session">Session #:</label><br />
				<input type="text" name="session" /><br />
				<label for="points">Points:</label><br />
				<input type="text" name="points" id="points" value="2"/><br />
				<label for="tenbounce">Ten Bounce Time:</label><br />
				<input type="text" name="tenbounce" /><br />
				<label for="notes">Notes:</label><br />
				<textarea cols="25" rows="5" name="notes"></textarea><br />
				<input type="submit" name="submitForm" value="Save" />
			</fieldset>
			</form>
		</div>
	<div id="footer">
	<p>SpearWare Mobile</p>
	</div>
  </div>
  </body>
</html>